<?php
require 'init.php';
extract($_POST);
$time = date('Y-m-d');
$name = rand(1,9999).$_FILES['image']['name'];
move_uploaded_file($_FILES['image']['tmp_name'], '../img/'.$name);
$db -> query("INSERT INTO `newsinfo` (`id`, `news_title`, `news_desc`, `news_content`, `news_press`, `image`, `news_createTime`, `author`, `admin`, `isdelete`) VALUES (NULL, '$title', '$desc', '$content', '$press', './img/$name', '$time', '$author', '$admin', '0')");
echo json_encode([
    'code' => 200,
    'msg' => '添加成功'
])

?>
